<template>
	<view>
		<view class="content-wrap">
			<view class="avatar"><image :src="info.avatar" mode=""></image></view>
			<view class="info-wrap">
				<view class="name">{{info.nickname || ''}}</view>
				<view class="license-wrap">
					<text class="age">驾龄：{{info.drivingYears || ''}}年</text>
					<text class="grade">驾照等级：{{info.drivingLevel || ''}}</text>
				</view>
				<view class="score">历史平均分：{{info.serviceScore || ''}}分</view>
			</view>
			
			<view class="detail-wrap">
				<view class="intro">
					<text class="tit">个人说明：</text>{{info.personalDescription || ''}}
				</view>
				<view class="detail_content">
					<view class="tit">个人荣誉：</view>
					<view class="honor_list">
						<view 
							class="honor_item"
							v-for="(item, index) in honorList"
							:key="index"
						>
							<image :src="item" mode=""></image>
						</view>
					</view>
				</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				driverId: 0,
				info: {},
				honorList: []
			};
		},
		onLoad(opt) {
			this.driverId = opt && opt.id
			this.getDetail()
		},
		methods: {
			getDetail() {
				this.$http.get(this.$api.getDriverDetail+this.driverId).then(res => {
					if (res.code === 200) {
						this.info = res.data
						this.honorList = res.data.personalHonor && res.data.personalHonor.split(',')
					}
				})
			}
		}
	}
</script>

<style>
	page {
		background-color: #00B4FF;
	}
</style>
<style lang="scss" scoped>
.content-wrap {
	width: 620rpx;
	margin: 140rpx auto 0;
	background-color: #fff;
	border-radius: 20rpx;
	position: relative;
	padding-top: 100rpx;
	.avatar {
		height: 160rpx;
		width: 160rpx;
		border-radius: 50%;
		border: 2px solid #fff;
		background-color: pink;
		position: absolute;
		top: -80rpx;
		left: 50%;
		transform: translateX(-50%);
		overflow: hidden;
	}
	.info-wrap {
		display: flex;
		flex-direction: column;
		align-items: center;
		.name {
			font-size: 30rpx;
		}
		.license-wrap {
			font-size: 26rpx;
			padding: 29rpx 0;
			.age {
				padding-right: 60rpx;
			}
		}
		.score {
			color: $yellow;
		}
	}
	.detail-wrap {
		width: 540rpx;
		margin: 50rpx auto 0;
		border-top: 1px solid #ebebeb;
		.tit {
			color: #666;
			font-size: 26rpx;
		}
		.intro {
			font-size: 26rpx;
			line-height: 46rpx;
			padding: 37rpx 0 43rpx;
		}
		.detail_content {
			.tit {
				margin-bottom: 30rpx;
			}
			.honor_list {
				display: flex;
				justify-content: space-between;
				flex-wrap: wrap;
				.honor_item {
					width:260rpx;
					height:266rpx;
					margin-bottom: 30rpx;
					border-radius:12rpx;
					overflow: hidden;
					background-color: pink;
				}
			}
		}
	}
}
</style>
